﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BOMS.WebUI._Default" %>
<%@ Import Namespace="BOMS.WebUI.Web" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title><%=Common.GetHostName()%>电池在线监测维护系统</title>
<script type="text/javascript" src="Js/Jquery.js"></script>
<script type="text/javascript" src="Js/Dialog.js"></script>
<script type="text/javascript" src="Js/Main.js"></script>
<script type="text/javascript" src="Js/TabControl.js"></script>

<script type="text/javascript">
loadCss(_skinId,'Main.css');
var isIE6 = false;
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : 0;
if (Sys.ie && Sys.ie == "6.0") {
    isIE6 = true;
}
$(function () {    
    //轮询执行
    window.setInterval("ajaxRefreshPopup()",'<%=Common.RefreshIntev%>');

    $(window).load(
        function () {
        $("div[id=newnotice]").css({ "right": "0px", "bottom": "1px" });
        //$("div[id=newnotice]").slideDown("slow");
        /*setTimeout(function(){$("div[id=newnotice]").slideUp("slow")},10000);*/
        ajaxRefreshPopup();//加载页面时执行一次；
    }).scroll(function () {

        if (isIE6) {
            $("div[id=newnotice]").css({ "bottom": "0px" });
            $("div[id=newnotice]").css({ "right": "0px", "bottom": "1px" });
        }
        else {
            $("div[id=newnotice]").css({ "right": "1px" });
            $("div[id=newnotice]").css("bottom", "-" + document.documentElement.scrollTop + "px");
        }
    }).resize(function () {
        if (isIE6) {
            $("div[id=newnotice]").css({ "bottom": "0px" });
            $("div[id=newnotice]").css({ "right": "0px", "bottom": "1px" });
        }
        else {
            $("div[id=newnotice]").css({ "right": "1px" });
            $("div[id=newnotice]").css("bottom", "-" + document.documentElement.scrollTop + "px");
        }
    });

    $("label[id=tomin]").click(function () {
        $("div[id=noticecon]", "div[id=newnotice]").slideUp();
    });

    $("label[id=tomax]").click(function () {
        $("div[id=noticecon]", "div[id=newnotice]").slideDown();
    });

    $("label[id=toclose]").click(function () {
        $("div[id=newnotice]").hide();
    });
});
//scroll: 滚动时候保持在页面右侧底部.
//resize: 浏览器变化时候  保持在页面右侧底部.

function Popup(tip) {
   
    $("div[id=newnotice]").show();
     $("div[id=noticecon]", "div[id=newnotice]").slideDown();
   // $("div[id=newnotice]").slideDown("slow");
    if (tip) {        
        $("#tip", "div[id=newnotice]").html(tip);
    }
}
function Pophide() {   
    $("div[id=newnotice]").hide();  
}
function ajaxRefreshPopup() {
    $.ajax({
        type: "POST",
        dataType: "json",        
        url: "Web/WarningDataHandler.ashx?rdm="+Math.random()+"&TimeIntev=<%=Common.RefreshIntev%>",        
        success: function (json) {
            //alert(<%=Common.RefreshIntev%>);
            if (json.Data.length > 0) {
                var md = json.Data[0];
                var str = "";
                if(md.BatteryId>=1){
                     str = "现场主机:<b>" + md.HostName + "</b>电池组:<b>" + md.BatteryGroup + "</b>电池:<b>" + md.BatteryId + "</b><br/>报警类型:<b>" + md.WarningStatus+"</b>"
                        + "<br/>(共有<b>"+json.AllWaringCount+"</b>条报警信息待处理)"
                    }else{
                     str = "现场主机:<b>" + md.HostName + "</b>电池组:<b>" + md.BatteryGroup + "</b><br/>报警类型:<b>" + md.WarningStatus+"</b>"
                        + "<br/>(共有<b>"+json.AllWaringCount+"</b>条报警信息待处理)"
                    }
                Popup(str);
            }
            else { 
                Pophide();
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert("Error123:"+textStatus+" " + XMLHttpRequest.responseText);
        },
        complete:function(XMLHttpRequest,textStatus){
            XMLHttpRequest=null;
        }
    });
}
function ShowMenu() {
    if (tdMenu.style.display == '') {
        tdMenu.style.display = 'none';
        gid("tdMenu1").title = gid("tdMenu2").title = "显示菜单"
    }
    else {
        tdMenu.style.display = '';
        gid("tdMenu1").title = gid("tdMenu2").title = "隐藏菜单"
    }
}
</script>
</head>
<body>
<div id="selectstyle">
    <b>系统风格：</b><a href="javascript:#" onclick="loadSkin('1')" id="style_1">默认</a>
    <a href="javascript:#" onclick="loadSkin('2')" id="style_2">经典</a>
    <a href="javascript:#" onclick="loadSkin('3')" id="style_3">藤绿</a>
    <a href="javascript:#" onclick="loadSkin('4')" id="style_4">雅灰</a>
</div>
<div id="topinfo">
    <asp:Label ID="welcome" runat="server"></asp:Label> | <a href="javascript:top.myTab.Cts('密码管理','sysChangePwd.aspx',true)">密码管理</a> | <a href="javascript:window.parent.location='Logout.aspx'">退出系统</a>
</div>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
        <td height="75" colspan="2" class="top"><b>基站蓄电池在线监测维护管理系统</b></td>
    </tr>
    <tr>
        <td class="menuwidth" id="tdMenu">
            <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="menu11"></td>
                    <td class="menu12"><b></b></td>
                    <td class="menu13"></td>
                </tr>
                <tr>
                    <td class="menu21"></td>
                    <td class="menu22" valign="top"><iframe style="width:100%; height:100%" frameborder="0" src="Menu.aspx"></iframe></td>
                    <td class="menu23" id="tdMenu1" onclick="ShowMenu()">
                    <div class="tripbar"></div>
                    </td>
                </tr>
                <tr>
                    <td class="menu31"></td>
                    <td class="menu32"></td>
                    <td class="menu33"></td>
                </tr>
            </table>
        </td>
        <td valign="top">
            <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="right11"></td>
                    <td class="right12"></td>
                    <td class="right13"></td>
                </tr>
                <tr>
                    <td class="right21" id="tdMenu2" onclick="ShowMenu()"></td>
                    <td class="right22" valign="top">
                    <script type="text/javascript"> var myTab = new HTabControl(_skinId, true); document.write(myTab.init()); myTab.Cts("系统首页", "Web/Message.aspx")</script>
                    </td>
                    <td class="right23"></td>
                </tr>
                <tr>
                    <td class="right31"></td>
                    <td class="right32"></td>
                    <td class="right33"></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td height="48" colspan="2" class="bot"><b>Copyright © 1998-2013 北京嘉捷恒信能源技术有限公司<span></span></b></td>
    </tr>
</table>
<div id="newnotice">
    <p>
        <span class="title">最新未处理的报警信息</span>
        <span id="bts">
        <label class="button" id="tomin" title="最小化"> </label>
        <label class="button" id="tomax" title="最大化"> </label>
        <label class="button" id="toclose" title="关闭"> </label>
        </span>
    </p>
    <div id="tip"></div>
    <div id="noticecon"><img src="Alarm/pic/warning.gif" alt="" /></div>
</div>
</body>
</html>